package com.qk.management.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qk.entity.Activity;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ActivityMapper extends BaseMapper<Activity> {
    List<Activity> list(
            @Param("channel") String channel,
            @Param("type") Integer type,
            @Param("status") Integer status
    );

    @Delete("delete from activity where id = #{id}")
    void deleteById(Integer id);

    @Insert("insert into activity(channel,name,start_time,end_time,description,type,discount,voucher,create_time,update_time) values(#{channel},#{name},#{startTime},#{endTime},#{description},#{type},#{discount},#{voucher},now(),now())")
    void add(Activity activity);

    @Select("select * from activity where id = #{id}")
    Activity getById(Integer id);

    void update(Activity activity);

    List<Activity> findByType(Integer type);
}